@@ -100,7 +100,8 @@ module Agents |
||
100 | 100 |
if interpolated['secrets'].include?(params['secret']) |
101 | 101 |
items = received_events.order('id desc').limit(events_to_show).map do |event| |
102 | 102 |
interpolated = interpolate_options(options['template']['item'], event) |
103 |
- interpolated['guid'] = event.id |
|
103 |
+ interpolated['guid'] = {'_attributes' => {'isPermaLink' => 'false'}, |
|
104 |
+ '_contents' => interpolated['guid'].presence || event.id} |
|
104 | 105 |
date_string = interpolated['pubDate'].to_s |
105 | 106 |
date = |
106 | 107 |
begin |
@@ -125,8 +126,9 @@ module Agents |
||
125 | 126 |
else |
126 | 127 |
content = Utils.unindent(<<-XML) |
127 | 128 |
<?xml version="1.0" encoding="UTF-8" ?> |
128 |
- <rss version="2.0"> |
|
129 |
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
|
129 | 130 |
<channel> |
131 |
+ <atom:link href="#{feed_link.encode(:xml => :text)}/users/#{user.id}/web_requests/#{id || '<id>'}/#{params['secret']}.xml" rel="self" type="application/rss+xml" /> |
|
130 | 132 |
<title>#{feed_title.encode(:xml => :text)}</title> |
131 | 133 |
<description>#{feed_description.encode(:xml => :text)}</description> |
132 | 134 |
<link>#{feed_link.encode(:xml => :text)}</link> |
@@ -117,8 +117,9 @@ describe Agents::DataOutputAgent do |
||
117 | 117 |
expect(content_type).to eq('text/xml') |
118 | 118 |
expect(content.gsub(/\s+/, '')).to eq Utils.unindent(<<-XML).gsub(/\s+/, '') |
119 | 119 |
<?xml version="1.0" encoding="UTF-8" ?> |
120 |
- <rss version="2.0"> |
|
120 |
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
|
121 | 121 |
<channel> |
122 |
+ <atom:linkhref="https://yoursite.com/users/#{agent.user.id}/web_requests/#{agent.id}/secret1.xml" rel="self" type="application/rss+xml"/> |
|
122 | 123 |
<title>XKCD comics as a feed</title> |
123 | 124 |
<description>This is a feed of recent XKCD comics, generated by Huginn</description> |
124 | 125 |
<link>https://yoursite.com</link> |
@@ -131,7 +132,7 @@ describe Agents::DataOutputAgent do |
||
131 | 132 |
<description>Secret hovertext: Something else</description> |
132 | 133 |
<link>http://imgs.xkcd.com/comics/evolving0.png</link> |
133 | 134 |
<pubDate>#{Time.zone.parse(event3.payload['date']).rfc2822}</pubDate> |
134 |
- <guid>#{event3.id}</guid> |
|
135 |
+ <guid isPermaLink="false">#{event3.id}</guid> |
|
135 | 136 |
</item> |
136 | 137 |
|
137 | 138 |
<item> |
@@ -139,7 +140,7 @@ describe Agents::DataOutputAgent do |
||
139 | 140 |
<description>Secret hovertext: Something else</description> |
140 | 141 |
<link>http://imgs.xkcd.com/comics/evolving2.png</link> |
141 | 142 |
<pubDate>#{event2.created_at.rfc2822}</pubDate> |
142 |
- <guid>#{event2.id}</guid> |
|
143 |
+ <guid isPermaLink="false">#{event2.id}</guid> |
|
143 | 144 |
</item> |
144 | 145 |
|
145 | 146 |
<item> |
@@ -147,7 +148,7 @@ describe Agents::DataOutputAgent do |
||
147 | 148 |
<description>Secret hovertext: Biologists play reverse Pokemon, trying to avoid putting any one team member on the front lines long enough for the experience to cause evolution.</description> |
148 | 149 |
<link>http://imgs.xkcd.com/comics/evolving.png</link> |
149 | 150 |
<pubDate>#{event1.created_at.rfc2822}</pubDate> |
150 |
- <guid>#{event1.id}</guid> |
|
151 |
+ <guid isPermaLink="false">#{event1.id}</guid> |
|
151 | 152 |
</item> |
152 | 153 |
|
153 | 154 |
</channel> |
@@ -170,7 +171,7 @@ describe Agents::DataOutputAgent do |
||
170 | 171 |
'title' => 'Evolving yet again with a past date', |
171 | 172 |
'description' => 'Secret hovertext: Something else', |
172 | 173 |
'link' => 'http://imgs.xkcd.com/comics/evolving0.png', |
173 |
- 'guid' => event3.id, |
|
174 |
+ 'guid' => {"contents" => event3.id, "isPermaLink" => "false"}, |
|
174 | 175 |
'pubDate' => Time.zone.parse(event3.payload['date']).rfc2822, |
175 | 176 |
'foo' => 'hi' |
176 | 177 |
}, |
@@ -178,7 +179,7 @@ describe Agents::DataOutputAgent do |
||
178 | 179 |
'title' => 'Evolving again', |
179 | 180 |
'description' => 'Secret hovertext: Something else', |
180 | 181 |
'link' => 'http://imgs.xkcd.com/comics/evolving2.png', |
181 |
- 'guid' => event2.id, |
|
182 |
+ 'guid' => {"contents" => event2.id, "isPermaLink" => "false"}, |
|
182 | 183 |
'pubDate' => event2.created_at.rfc2822, |
183 | 184 |
'foo' => 'hi' |
184 | 185 |
}, |
@@ -186,7 +187,7 @@ describe Agents::DataOutputAgent do |
||
186 | 187 |
'title' => 'Evolving', |
187 | 188 |
'description' => 'Secret hovertext: Biologists play reverse Pokemon, trying to avoid putting any one team member on the front lines long enough for the experience to cause evolution.', |
188 | 189 |
'link' => 'http://imgs.xkcd.com/comics/evolving.png', |
189 |
- 'guid' => event1.id, |
|
190 |
+ 'guid' => {"contents" => event1.id, "isPermaLink" => "false"}, |
|
190 | 191 |
'pubDate' => event1.created_at.rfc2822, |
191 | 192 |
'foo' => 'hi' |
192 | 193 |
} |
@@ -256,7 +257,7 @@ describe Agents::DataOutputAgent do |
||
256 | 257 |
'title' => 'Evolving', |
257 | 258 |
'description' => 'Secret hovertext: Biologists play reverse Pokemon, trying to avoid putting any one team member on the front lines long enough for the experience to cause evolution.', |
258 | 259 |
'link' => 'http://imgs.xkcd.com/comics/evolving.png', |
259 |
- 'guid' => event.id, |
|
260 |
+ 'guid' => {"contents" => event.id, "isPermaLink" => "false"}, |
|
260 | 261 |
'pubDate' => event.created_at.rfc2822, |
261 | 262 |
'enclosure' => { |
262 | 263 |
"type" => "audio/mpeg", |
@@ -291,8 +292,9 @@ describe Agents::DataOutputAgent do |
||
291 | 292 |
expect(content_type).to eq('text/xml') |
292 | 293 |
expect(content.gsub(/\s+/, '')).to eq Utils.unindent(<<-XML).gsub(/\s+/, '') |
293 | 294 |
<?xml version="1.0" encoding="UTF-8" ?> |
294 |
- <rss version="2.0"> |
|
295 |
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
|
295 | 296 |
<channel> |
297 |
+ <atom:linkhref="https://yoursite.com/users/#{agent.user.id}/web_requests/#{agent.id}/secret1.xml" rel="self" type="application/rss+xml"/> |
|
296 | 298 |
<title>XKCD comics as a feed</title> |
297 | 299 |
<description>This is a feed of recent XKCD comics, generated by Huginn</description> |
298 | 300 |
<link>https://yoursite.com</link> |
@@ -316,7 +318,7 @@ describe Agents::DataOutputAgent do |
||
316 | 318 |
</first> |
317 | 319 |
</complex> |
318 | 320 |
</simpleNested> |
319 |
- <guid>#{event.id}</guid> |
|
321 |
+ <guid isPermaLink="false">#{event.id}</guid> |
|
320 | 322 |
</item> |
321 | 323 |
|
322 | 324 |
</channel> |